<?php
/**
 * Created by PhpStorm.
 * User: wangwenfan
 * Date: 16-10-26
 * Time: 上午11:47
 */

namespace Common\Model;
use Think\Model;

class ColorModel extends Model
{
    protected $_validate = [
        ['color_name', 'require', '颜色名称必须填写！'],
        ['color_number', 'require', '色号必须填写！'],
        ['color_name', '', '颜色名称已经存在！', 0, 'unique', 1],
        ['color_name', '', '色号已经存在！', 0, 'unique', 1],
    ];

    //颜色列表
    public function lists(){
        $counts=$this->where("status=%d",1)->count();
        $page=page($counts,20,5);
        $list=$this->where("status=%d",1)->limit($page->firstRow,$page->listRows)->select();
        $arr['page']=$page;
        $arr['list']=$list;
        return $arr;
    }

}